<?php $this->start('admin_menu')?>
	<?php echo $this->element('admin_menu', array('str_item' => 'agents')) ?>
<?php $this->end(); ?>
<div class="agents form">
	<h1><?php echo __('Edit Agent'); ?></h1>
	<?php echo $this->Session->flash(); ?>
	<?php echo $this->Form->create('Agent'); ?>
		<?php
			echo $this->Form->input('id');
		?>
	<table class='form-table'>
		<tr>
			<td class='left-cl-style'>Name<span class='star-rq'> * </span></td>
			<td class='right-cl-style'><?php echo $this->Form->input('name', array('label' => false)); ?></td>
		</tr>
		<tr>
			<td class='left-cl-style'>Address<span class='star-rq'> * </span></td>
			<td class='right-cl-style'><?php echo $this->Form->input('address', array('label' => false, 'class' => 'mid-input')); ?></td>
		</tr>
		<tr>
			<td class='left-cl-style'>Phone<span class='star-rq'> * </span></td>
			<td class='right-cl-style'><?php echo $this->Form->input('phone', array('label' => false)); ?></td>
		</tr>
		<tr>
			<td class='left-cl-style'>Email<span class='star-rq'> * </span></td>
			<td class='right-cl-style'><?php echo $this->Form->input('email', array('label' => false)); ?></td>
		</tr>
		<tr>
			<td class='left-cl-style'>Type<span class='star-rq'> * </span></td>
			<td class='right-cl-style'><?php echo $this->Form->input('type', array('label' => false)); ?></td>
		</tr>
		<tr>
			<td class='left-cl-style'>Status<span class='star-rq'> * </span></td>
			<td class='right-cl-style'><?php echo $this->Form->input('status', array('label' => false)); ?></td>
		</tr>
		<tr>
			<td class='left-cl-style'>Code<span class='star-rq'> * </span></td>
			<td class='right-cl-style'><?php echo $this->Form->input('code', array('label' => false)); ?></td>
		</tr>
		<tr>
			<td class='left-cl-style'>Account</td>
			<td class='right-cl-style'>
				<?php if($this->Form->value('User.email')): ?>
					<?php echo $this->Form->value('User.email'); ?> | 
					<?php echo $this->Html->link('Edit account', array('controller' => 'users', 'action' => 'edit',  $this->Form->value('User.id'))); ?>
				<?php else: ?>
					<?php echo $this->Html->link('Create account', array('controller' => 'users', 'action' =>'add', '?' => array('aid' => $this->Form->value('User.id'), 'email' => $this->Form->value('User.email'))),
																	array('class' => 'action-link')); ?>
				<?php endif; ?>		
			</td>
		</tr>
		<tr>
			<td class='left-cl-style'>Credit</td>
			<td class='right-cl-style'>
				<?php if($this->Form->value('Credit.name')): ?>
					<?php echo $this->Form->value('Credit.name'); ?> | 
					<?php echo $this->Html->link('Edit credit', array('controller' => 'credits', 'action' => 'edit', $this->Form->value('Credit.id'))); ?>
				<?php else: ?>
					<?php echo $this->Html->link('Add credit', array('controller' => 'credits', 'action' =>'add', '?' => array('aid' => $this->Form->value('Credit.id'))),
																array('class' => 'action-link')); ?>			
				<?php endif; ?>					
			</td>
		</tr>
		<tr>
			<td class='left-cl-style no-border no-background'>
				(<span class='red-star'>*</span>) Required
			</td>
			<td class='right-cl-style actions no-border no-background'>
				<?php echo $this->Form->input('Submit', array('type' => 'submit', 'label' => false)); ?>
			</td>
		</tr>
	</table>
	<?php echo $this->Form->end(); ?>	
</div>
<div class='actionct'>
	<span class='btn-act'><span><?php echo $this->Html->link(__('List Agents'), array('action' => 'index'), array('class' => 'back-act')); ?></span></span>
	<span class='btn-act'><span><?php echo $this->Form->postLink(__('Delete'), array('action' => 'delete', $this->Form->value('Agent.id')), array('class' => 'del-link'), __('Are you sure you want to delete # %s?', $this->Form->value('Agent.id'))); ?></span></span>
	<span class='btn-act'><span><?php echo $this->Html->link(__('View'), array('action' => 'view', $this->Form->value('Agent.id')), array('class' => 'act-lk show-link')); ?></span></span>
</div>
